---
id: "raw-top-level-expression"
keywords: ["javascript", "raw"]
name: "%%raw"
summary: "This is the `raw top level expression` extension point."
category: "extensionpoints"
---

`%%raw` is used to embed top level JavaScript code.

<CodeTab labels={["ReScript", "JS Output"]}>

```res
%%raw(`
  const message = "hello";

  function greet(m) {
    console.log(m)
  }

  greet(message)
`)
```

```js
const message = "hello";

function greet(m) {
  console.log(m);
}

greet(message);
```

</CodeTab>

It's also very useful to do imports with side-effects like this:

<CodeTab labels={["ReScript", "JS Output"]}>

```res
%%raw(`import "main.css"`)
```

```js
import "main.css";
```

</CodeTab>

See [`%raw`](./extension_raw_expression.mdx) for embedding JavaScript expressions rather than top level blocks of code.

### References

- [Embed Raw JavaScript](../docs/manual/embed-raw-javascript.mdx)
- [Extension Point Attributes](../docs/manual/attribute.mdx#extension-point)
- [Converting from JS](../docs/manual/converting-from-js.mdx)
